﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Content/Master.Master" Inherits="System.Web.Mvc.ViewPage<SCS.Core.ViewModels.OrderViewModels>" %>
<%@ Import Namespace="SCS.Core" %>
<%@ Import Namespace="SCS.Core.Models" %>
<%@ Import Namespace="SCS.Core.ViewModels" %>
<%@ Import Namespace="SCS.Core.Controllers" %>
<%@ Import Namespace="SCSService" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Đơn đặt hàng
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.js"></script>
    <script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.stack.js"></script>	
   
    <%--<script type="text/javascript" src="/Scripts/jquery-1.6.1.min.js">
        var $ = jQuery.noConflict();
    </script>--%>
    <script type="text/javascript">
        var $ = jQuery.noConflict();
    </script>
   <script type="text/javascript" src="/Scripts/jquery-ui-1.8.13.custom.min.js"></script>
   <%--  <script type="text/javascript" src="/Scripts/ui.dropdownchecklist-1.4-min.js"></script>
    <script type="text/javascript" src="/Scripts/ui.dropdownchecklist.js"></script>
   <link rel="stylesheet" type="text/css" href="/Content/smoothness-1.8.13/jquery-ui-1.8.13.custom.css"/>
    <link rel="stylesheet" type="text/css" href="/Content/smoothness-1.8.13/ui.dropdownchecklist.themeroller.css"/>--%>


   <script type="text/javascript">
       function getShippment(value) {
           $.ajax({
               type: "POST",
               url: '<%=Url.Action("GetListPupupShipment","HomeMaster")%>' + '/' + value,
               contentType: "application/json; charset=utf-8",
               dataType: "json",
               success: function (result) {
                    
                   //var innertext = result
                   // $('#TemplateTable').val(result);
                   $('#TemplateTable').html(result.toString());
                   var div = $("#TemplateTable");
                   div.html(result);
               }
           });

       }
    </script>

 <script type="text/javascript">
     var $ = jQuery.noConflict();
     $(function () {
         
         $("#StartDate").datepicker();
         $("#EndDate").datepicker();
     });
	</script>
    
     <% int index = 1;
        
         %>
      <% using (Html.BeginForm("ListOrder", "HomeMaster", FormMethod.Post, new { id = "sendFileForm", enctype = "multipart/form-data" }))
   {%>
    <div class="clear"></div>
    <div class="column full">
    <div class="box ">
        
		<h2 class="box-header">Đơng hàng</h2>
		<div class="box-content">

                    <div id="grid">	
                  	           <%-- <table>
                                <tr>                            
                                        <td>
                                            Ngày bắt đầu <%=Html.TextBoxFor(m=>m.StartDate,new { @class = "form-field hafl "}) %>  
                                        </td>

                                        <td>
                                            Đến ngày: <%=Html.TextBoxFor(m=>m.EndDate,new { @class = "form-field hafl " }) %>
                                                
                                        </td>

                                <td>    <%
                                                List<SelectListItem> statusSearch = new List<SelectListItem>();
                                                statusSearch.AddRange(new SelectListItem[] { 
                                                new SelectListItem{ Text = "Tất cả", Value = "" },
                                                new SelectListItem{ Text = "Chưa thanh toán", Value = "0" },
                                                new SelectListItem{ Text = "Đã thanh toán", Value = "1" },
                                                new SelectListItem{ Text = "Trạng thái treo", Value = "2" }
                                                });
                                                %>
                                                    <%=Html.DropDownListFor(m => m.StatusSearch, statusSearch)%> 
                                        </td>
                                                                   
                                        <td>
                                            
                                            <input type="submit" value="Tìm kiếm" class="button themed"/>
                                        </td>
                                        </tr>
                                </table>		        --%>       
				                <table class="display" id="tabledata">
                                <thead>
					                <tr>
                                        <th>
                                           STT
                                        </th>
                                        
						                <th>
                                            <a href="#" class="<%= HomeMasterController.GetGridThClass(ViewData, "OrderID") %>" 
										                onclick="<%= HomeMasterController.GetGridThOnClick(ViewData, "OrderID")%>">
								               Mã Đơn Hàng</a>
                                        </th>
                                        
                                        <th>
                                            <a href="#" class="<%= HomeMasterController.GetGridThClass(ViewData, "Fullname") %>" 
										                onclick="<%= HomeMasterController.GetGridThOnClick(ViewData, "Fullname")%>">
								                Tên Người Đặt Hàng</a>
                                        </th>
                                                     
						                <th>
							                <a href="#" class="<%= HomeMasterController.GetGridThClass(ViewData, "StartDate") %>" 
										                onclick="<%= HomeMasterController.GetGridThOnClick(ViewData, "StartDate")%>">
								                Ngày Tạo Đơn Hàng</a>
						                </th> 
                                        
                                        <th>
                                         Số điện thoại
                                        </th>
                                        <th>Email</th>  
                                        <th>
                                         <a href="#" class="<%= HomeMasterController.GetGridThClass(ViewData, "OrderStatus") %>" 
										                onclick="<%= HomeMasterController.GetGridThOnClick(ViewData, "OrderStatus")%>">
								                Tình Trang Đơn Hàng</a>
                                        </th>  
                                        <th>Hành động</th>                                     
					                </tr>
                                        
                                                          
                                </thead>
                                <% if (Model.ListCustomer_Order.Count() == 0)
                                   { %>
			                        <tbody>
                                        <tr>
                                            <td colspan="6">
                                               Không tìm thấy
                                            </td>
                                        </tr>
                                    </tbody>
		                        <% } else {  %>
                                <tbody>
					                <% foreach (var item in Model.ListCustomer_Order) { %>
				                      
						                <tr>
                                            <td>
                                                <% string textstatus = "Trạng thái chưa xử lý";%>
								                <%: (index++).ToString() %>
							                </td>						                
							                <td>
								                <%: item.OrderID.ToString().Trim() %>
							                </td>
							
                                            <td>
                                                <%: item.Fullname.ToString().Trim()%>
                                            </td>

                                            <td>
                                                <%: item.CreateDate.ToString().Trim()%>
                                            </td>

                                            <td>
                                            <%: item.Phone %>
                                            </td>
                                            <td>
                                             <%: item.Email %>
                                            </td>
							              
                                           
                                            <td>
                                               <%
                                                    //bool newStatus=false;

                                                if ((int)item.OrderStatus == 0)
                                                {
                                                    //newStatus=true;
                                                    textstatus = "Chưa thanh toán";
                                                }

                                                if ((int)item.OrderStatus == 1)
                                                {
                                                        //newStatus=false;
                                                 textstatus = "Đã thanh toán";
                                                }
                                                if ((int)item.OrderStatus == 2)
                                                {
                                                    textstatus = "Trạng thái treo";
                                                }
                                                
                                                %>
                                                <%=textstatus%>
                                               
                                            </td>
                                            <td>
                                                 <span class="button white"><%: Html.ActionLink(".", "DetailOrder", new { id = item.OrderID }, new { @class = "icon_single viewdetail", style = "color:#eaeaea;" })%></span>
                                          
                                                 <%
                                                    string returnUrl = Request.Url.ToString();
                                                 %>
                                                <span class="button white"><%: Html.ActionLink(".", "DeleteCustomerOrder", new { id = item.OrderID, returnUrl = returnUrl }, new { @class = "icon_single cancel", style = "color:#eaeaea;", onclick = "return confirm('Bạn muốn xóa đơn hàng mã :" + item.OrderID + " ?');" })%></span>
                                            </td>
                                            <%--<td>
                                               
                                                <%: Html.ActionLink("Confirm", "ConfirmCustomerOrder", new { id = item.OrderID, returnUrl = returnUrl }, new { onclick = "return confirm('Confirm:" + item.Fullname + " ?');" })%>
                                            </td>--%>
						                </tr>
				    
					                <% } %>
					            </tbody>
                                <% } %>
				                </table>
			                <!-- data -->
                                <%--<% if (Model.ListCustomer_Order.Count() > 0)
                                   { %>
			                       <% Html.RenderPartial("~/Views/Commont/Paging.ascx"); %>
		                        <% } %>
		                --%>
	                </div>  <!-- grid -->	
                
               
	    </div>
	</div>
    <div class="clear"></div>
   
    </div>    
<% } %>
 
                                              
     <script type="text/javascript">
         function getTemModify() {
             var iframe = document.getElementById("Content_TemplateDetail_html");

             if (document.all || document.getElementById) {
                 document.getElementById('Content_TemplateDetailValueINOUT').value = iframe.contentWindow.document.body.innerHTML;
             }
             else {
                 document.getElementById('Content_TemplateDetailValueINOUT').setAttribute("value", iframe.contentWindow.document.body.innerHTML);
             }

             // document.getElementById("btnSaveTemplate").disabled = true;

         }
</script>                       
</asp:Content>
